#!/bin/bash

current=$(mpc current)

if [ "$current" ]; then

	artist=$(mpc -f '%artist%' | head -1)
	title=$(mpc -f '%title%' | head -1)

	if [ ! "$title" ] && [ ! "$artist" ];then
		occurs=$(mpc -f %'file'% | head -1 | grep -o '/' | wc -l)
		occurs=$((occurs+1))
		title=$(mpc -f %'file'% | head -1 | cut -d '/' -f $occurs)
		echo $title
	elif [ ! "$title" ]; then
		occurs=$(mpc -f %'file'% | head -1 | grep -o '/' | wc -l)
		occurs=$((occurs+1))
		title=$(mpc -f %'file'% | head -1 | cut -d '/' -f $occurs)
		echo $artist - $title
	fi

	echo $artist - $title
fi
